#ifndef HEADERPARSE_H
#define HEADERPARSE_H

#define HEADER_SIZE         2048
#define HEADERMAXLINE  20

#define METHOD_SIZE        10
#define PATH_SIZE               500
#define ACCEPTTYPE_SIZE  30

#define KEY_SIZE	       40
#define VALUE_SIZE              500

#define URLVALUE_SIZE       20

typedef struct 
{
	char key[KEY_SIZE];
	char value[VALUE_SIZE];
}KEYVALUE;

class HeaderParse
{
public:
	HeaderParse(const char *header);
	~HeaderParse();
	void getMethod(char *method);
	void getPath(char *path);

	void printHeader();
	void getValueByKey(const char *key, char *value);
	void getUrlValueByKey(const char *key, char *value);
private:
	char m_header[HEADER_SIZE];
	char m_Method[METHOD_SIZE];
	char m_Path[PATH_SIZE];
	char m_AcceptType[ACCEPTTYPE_SIZE];

	KEYVALUE m_UrlValue[URLVALUE_SIZE];
	KEYVALUE m_UserInfo[HEADERMAXLINE];

	int m_UrlValuelen;
	int m_headerlinelen;  //header len
};

#endif //HEADERPARSE_H